Building The Installer

Sunday, February 19, 2023

8:46 AM

During normal OneMore development, you do not need to build the entire solution every time you make a change. The installer, for example only needs to be built when you want an installer. First, build OneMore, OneMoreCalendar, and OneMoreProtocolHandler to get the necessary run-time dependencies. Then you'll typically only need to rebuild OneMore from change to change, making it very quick to iterate.

 

If you've followed the setregistry.ps1 instructions on the Scripts page, then you should be able to continually build and test OneMore without reinstalling or rebuilding the installer. But if you do need to rebuild the installer, keep reading.

 

📓

x86 vs x64

There is no technical different between the 32-bit build and 64-bit builds of OneMore and its DLLs so OneMore is built as a 32-bit/x86 assembly; this can be used in both x86 and x64 versions of OneNote.

 

However, there is a difference in the 32-bit and 64-bit builds of the OneMore installer. If you have Windows 32-bit then you must use the 32-bit installer. If you Windows 64-bit then you must use the 64-bit installer. Note that the bitness of the installer must match the bitness of Windows. The bitness of Microsoft Office is irrelevant and has no bearing on OneMore or its installer.

 

Prep

Prior to running build.ps1 as described below, you must first configure your machine to enable Visual Studio to build Visual Studio Installer Projects (.vdproj) from the command line. It only needs to be run once on your machine, or after a reinstall or upgrade of Visual Studio.

 

From an administrative PowerShell prompt, run this command

 

.\build.ps1 -prep

 

Update SDK

Recommended when pulling down a new clone of the repo to patch the OneMore.csproj file.

 

.\update-sdk.ps1

 

Build The Projects

If you haven't yet built the csproj projects, you can do so from the command line using this command

 

.\build-ps1 -fast

 

Build The Installer

The setup project is configured to generate a 64-bit Windows installer with the idea that there are very few, if any, 32-bit machines still in use out there. But this 64-bit installer is customized to support both 64-bit and 32-bit installs of OneNote. So one installer to rule them all!

 

However, if a 32-bit installer is needed, use the provided build.ps1 script with the 86 argument. This script can be run in three modes.

 

  • .\build.ps1 86 - builds just the x86 installer
  • .\build.ps1 64 - builds just the x64 installer; the default if no arguments are provided
  • .\build.ps1 -both - builds both the x86 and the x64 installers

 

Note that you wil see warnings while the installer is building. These are harmless and can be ignored.
 

Debug The Build

To enable msbuild verbose logging, enter this command before runnig build.ps1, where vsregedit is in the same path as devenv.

 

VsRegEdit set local HKCU General MSBuildLoggerVerbosity dword 4

 

This can reverted back to a value of 1

 

HRESULT

If the output looks similar to this, you may need to r erun the .\build.ps1 -prep command

 

Microsoft Visual Studio 2022 Version 17.8.3.

Copyright (C) Microsoft Corp. All rights reserved.

Build started at 5:04 PM...

------ Starting pre-build validation for project 'Setup' ------

ERROR: An error occurred while validating.  HRESULT = '8000000A'

------ Pre-build validation for project 'Setup' completed ------

1>------ Build started: Project: Setup, Configuration: Debug ------

========== Build: 0 succeeded, 1 failed, 4 up-to-date, 0 skipped ==========

========== Build completed at 5:04 PM and took 00.201 seconds ==========

 

If that doesn't work then close Visual Studio and retry.

If that doesn't work then reboot. Seriously.

 

 

#omwiki #omdeveloper

 

© 2020 Steven M Cohn. All rights reserved.

Please consider a sponsorship or one-time donation to support ongoing development

 

 

 

Created with OneNote.